﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using YQGL.Common;

namespace YQGL.Controllers
{
    public class HomeController : Controller
    {
        //
        // GET: /Home/
        BLL.DJ_QYZCXX DJ_QYZCXXBLL = new BLL.DJ_QYZCXX();
        public ActionResult Index()
        {
            string LoginID = OperateSession.get("LoginID");
            if (string.IsNullOrEmpty(LoginID))
            {

                Response.Redirect(Url.Action("Index", "AdminLogin"));
            }
            else
            {
                ViewData["LoginID"] = LoginID;

                Model.DJ_QYZCXX infoModel = DJ_QYZCXXBLL.GetModel(LoginID);

                if (infoModel != null)
                {
                    if (infoModel.ZTDM == "2")
                    {


                        ViewData["Default"] = Url.Action("Index", "QYBB");
                    }
                    else
                    {
                        ViewData["Default"] = Url.Action("Index", "InfoPub");

                    }
                }
                else
                {
                    ViewData["Default"] = Url.Action("Index", "InfoPub");

                }
            }
            return View();
        }
        public ActionResult LogExit()
        {

            OperateSession.del("LoginID");
            OperateSession.del("AdminLoginID");
            Response.Redirect(Url.Action("Index", "AdminLogin"));
            return null;

        }

        public ActionResult LogExitYQ()
        {

            OperateSession.del("LoginID");
            OperateSession.del("AdminLoginID");
            Response.Redirect(Url.Action("Index", "Index"));
            return null;

        }
    }
}
